home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
MEMORY
/
OLD
/
MEM208SRC
/
FSLib
/
c
/
_GBPB
< prev
next >
Wrap
Text File
|
1993-08-22
|
1KB
|
45 lines
/* Original code (c) Acorn Computers Ltd, 1992-3 */
/* $Id: c._GBPB 3.1 93/03/09 23:19:57 brian Exp $ */
#include "FS.h"
_kernel_oserror *fsentry_gbpb( FSEntry_GBPB_Parameter *parm )
{
_kernel_oserror *err=NULL;
int pos,len;
FileEntry *fe=(FileEntry *)parm->handle;
FileDesc d = FileEntry_Desc( fe );
if ( d.buffered )
return ERR(mb_BadParameters);
pos = -1;
#ifdef DEBUG
printf("GBPB(%d)%x,%x,%x,%x\n",*parm);
#endif
switch ( parm->reason )
{
case FSEntry_GBPB_Reason_PutMultipleBytesHere:
pos = parm->sequential_file_pointer;
/* FALLTHROUGH */
case FSEntry_GBPB_Reason_PutMultipleBytes:
err=FileEntry_PutBytes( fe, parm->address, pos, len = parm->number,&pos );
break;
case FSEntry_GBPB_Reason_GetMultipleBytesHere:
pos = parm->sequential_file_pointer;
if (pos>d.length)
{ len = 0; err = NULL; pos = FileEntry_SeqPtr(fe); break; }
/* FALLTHROUGH */
case FSEntry_GBPB_Reason_GetMultipleBytes:
err=FileEntry_GetBytes( fe, parm->address, pos, parm->number,&pos,&len );
break;
default:
return ERR(mb_BadParameters);
}
if (err) return err;
parm->address+=len;
parm->number-=len;
parm->sequential_file_pointer=pos;
return NULL;
}